package mil.af.amc.adpetracker.web.actions;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.security.context.SecurityContextHolder;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Logout Action
 */
public class LogoutAction extends AbstractAction {

    public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws Exception {

        // Clear the SecurityContext for logout
        SecurityContextHolder.clearContext();
        return mapping.findForward("viewIndexPage");
        //return mapping.findForward("success");
    }
}

